package com.fzy.core.tags;

import ge.core.system.service.DictEntryListVo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fzy.core.spring.M;
import com.opensymphony.webwork.components.UIBean;
import com.opensymphony.xwork.util.OgnlValueStack;

public class Dict extends UIBean {
	
	private static final Logger log = LoggerFactory.getLogger(Dict.class);

	public Dict(OgnlValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		super(stack, request, response);
	}

	protected String getDefaultTemplate() {
		return "dict";
	}

	public void evaluateParams() {
		super.evaluateParams();
        if (name != null) {
        	
        	String expr = name;
        	String value = findString(expr);
        	
        	
        	DictEntryListVo dictEntry = M.getDictByTypeAndCode(value, "gender");
        	if(dictEntry != null) value = dictEntry.getName();
        	addParameter("dictName", findString(value));
//        	log.debug(name + "=" + value);
            //addParameter("name", findString(name));
        }
	}
	
}
